/******************************************************************************
*  author: enquanyan
*  version: 1.0
*  description:	abstract_conn header file;
*  date: 2014-08-04
*  other: 无
******************************************************************************/

#ifndef ABSTRACT_CONN_H
#define ABSTRACT_CONN_H

#include "def.h"
#include <netinet/in.h>
#include <arpa/inet.h>

enum CONN_TYPE
{
    HTTP_CONN_T = 0,
    FORWARD_CONN_T
};

class abstract_conn
{
    public:
        abstract_conn();
        
        virtual ~abstract_conn();

    public:
    
        char m_upload_file_name[FILENAME_LEN];
        
        int m_sockfd;
    
        CONN_TYPE conn_type;
        
        int thread_no;
        
        enum HANDLE_TYPE handle_type;
        
        bool is_read_ready;

        virtual void process(void);
        
        virtual void close_conn(bool real_close = true);
        
        virtual void init(int sockfd, const sockaddr_in& addr);
        
        virtual bool init(int remote_port,char* remote_ip);
        
};

#endif

